package com.easylinkin.linkappapi.rulecomponent.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.easylinkin.linkappapi.common.service.CommonService;
import com.easylinkin.linkappapi.rulecomponent.entity.RuleComponentService;
import com.easylinkin.linkappapi.rulecomponent.mapper.RuleComponentServiceMapper;
import com.easylinkin.linkappapi.rulecomponent.service.RuleComponentServiceService;
import com.easylinkin.linkappapi.security.context.LinkappUserContextProducer;
import com.easylinkin.linkappapi.security.entity.LinkappUser;

/**
 * <p>
 * 配电房 服务实现类
 * </p>
 *
 * @author TongJie
 * @since 2020-08-05
 */
@Service
public class RuleComponentServiceServiceImpl extends ServiceImpl<RuleComponentServiceMapper, RuleComponentService> implements RuleComponentServiceService {


    private static final Logger LOGGER = LoggerFactory.getLogger(RuleComponentServiceServiceImpl.class);

    @Resource
    private CommonService commonService;
    @Resource
    private LinkappUserContextProducer linkappUserContextProducer;
    
    @Resource
    private RuleComponentServiceMapper ruleComponentServiceMapper;

	@Override
	public void addRuleComponentService(RuleComponentService ruleComponentService) {
		LinkappUser user = linkappUserContextProducer.getCurrent();
		commonService.setCreateAndModifyInfo(ruleComponentService);
		ruleComponentService.setTenantId(user.getTenantId());
		ruleComponentServiceMapper.insert(ruleComponentService);
	}
	@Override
	public void deleteBatch(List<String> idList) {
		ruleComponentServiceMapper.deleteBatchIds(idList);
	}
	@Override
	public void updateRuleComponentService(RuleComponentService ruleComponentService) {
		commonService.setModifyInfo(ruleComponentService);
		ruleComponentServiceMapper.updateById(ruleComponentService);
	}
	@Override
	public List<RuleComponentService> getRuleComponentServices(RuleComponentService ruleComponentService) {
		return ruleComponentServiceMapper.getRuleComponentServices(ruleComponentService);
	}

	@Override
	public RuleComponentService getRuleComponentService(RuleComponentService ruleComponentService) {
		return ruleComponentServiceMapper.getRuleComponentService(ruleComponentService);
	}
	@Override
	public RuleComponentService getRuleComponentServiceById(String id) {
		return ruleComponentServiceMapper.selectById(id);
	}
	

 
}
